<?php
// Lakala Payment Extension Configuration
$uploadProps = [
    "action" => "{{API_BASE_URL}}/admin/filesystem/file",
    "name" => "file",
    "headers" => [
        "Authorization" => "Bearer {{API_TOKEN}}"
    ],
    "onSuccess" => "\$FNX:const res = \$inject.args[0];\nconst file = \$inject.args[1];\n\nfile.url = res.data.file_url;",
    "multiple" => false
];
// 子商户
$subMerchant = [
    [
        "type" => "input",
        "field" => "merchant_no",
        "title" => "商户号（merchant_no）",
        "props" => [
            "placeholder" => "请输入商户进件产生的商户号",
            "clearable" => true
        ],
        "validate" => [
            [
                "required" => true,
                "message" => "请输入商户号",
                "trigger" => "blur"
            ]
        ],
        "_fc_drag_tag" => "input",
        "_fc_id" => "id_Fk3smh2zkilk14hc",
        "name" => "ref_F285mh2zkilk14ic",
        "value" => "822290059430BF9",
        "display" => true,
        "hidden" => false
    ],
    [
        "type" => "input",
        "field" => "term_no",
        "title" => "终端号（term_no）",
        "props" => [
            "placeholder" => "请输入商户进件产生的终端号",
            "clearable" => true
        ],
        "validate" => [
            [
                "required" => true,
                "message" => "请输入终端号",
                "trigger" => "blur"
            ]
        ],
        "_fc_drag_tag" => "input",
        "_fc_id" => "id_Fnjzmh2zkilk14jc",
        "name" => "ref_F2l4mh2zkilk14kc",
        "value" => "D9261076",
        "display" => true,
        "hidden" => false
    ],
];
return [
    [
        "type" => "fcTitle",
        "props" => [
            "title" => "接入方配置信息",
            "size" => "H1"
        ],
        "_fc_drag_tag" => "fcTitle",
        "_fc_id" => "id_Fjeumh2zkilj145c",
        "name" => "ref_Fme4mh2zkilj146c",
        "display" => true,
        "hidden" => false
    ],
    [
        "type" => "elAlert",
        "props" => [
            "title" => "配置说明",
            "description" => "请填写接入方与拉卡拉系统对接所需的配置信息，所有带*的字段为必填项",
            "type" => "info",
            "effect" => "light",
            "closable" => false
        ],
        "_fc_drag_tag" => "elAlert",
        "_fc_id" => "id_Fjqmmh2zkilj147c",
        "name" => "ref_F6j6mh2zkilj148c",
        "display" => true,
        "hidden" => false
    ],
    [
        "type" => "elCard",
        "props" => [
            "header" => "基础配置信息"
        ],
        "style" => [
            "width" => "100%",
            "marginBottom" => "20px"
        ],
        "children" => [
            [
                "type" => "radio",
                "field" => "environment",
                "title" => "环境选择",
                "props" => [
                    "clearable" => false
                ],
                "options" => [
                    [
                        "label" => "测试环境",
                        "value" => "test"
                    ],
                    [
                        "label" => "生产环境",
                        "value" => "product"
                    ]
                ],
                "validate" => [
                    [
                        "required" => true,
                        "message" => "请选择环境",
                        "trigger" => "change"
                    ]
                ],
                "_fc_drag_tag" => "radio",
                "_fc_id" => "id_Fenvironment_001",
                "name" => "ref_Fenvironment_001",
                "value" => "test",
                "display" => true,
                "hidden" => false
            ],
            [
                "type" => "input",
                "field" => "appid",
                "title" => "接入方唯一编号（appid）",
                "props" => [
                    "placeholder" => "请输入拉卡拉分配的接入方唯一编号",
                    "clearable" => true,
                    "readonly" => false
                ],
                "validate" => [
                    [
                        "required" => true,
                        "message" => "请输入接入方唯一编号",
                        "trigger" => "blur"
                    ]
                ],
                "_fc_drag_tag" => "input",
                "_fc_id" => "id_Fqcomh2zkilj149c",
                "name" => "ref_Fpawmh2zkilj14ac",
                "value" => "OP00000003",
                "display" => true,
                "hidden" => false
            ],
            [
                "type" => "input",
                "field" => "serial_no",
                "title" => "证书序列号（serial_no）",
                "props" => [
                    "placeholder" => "请输入接入方生成的cer证书序列号",
                    "clearable" => true
                ],
                "validate" => [
                    [
                        "required" => true,
                        "message" => "请输入证书序列号",
                        "trigger" => "blur"
                    ]
                ],
                "_fc_drag_tag" => "input",
                "_fc_id" => "id_F4eimh2zkilj14bc",
                "name" => "ref_Fmj3mh2zkilj14cc",
                "value" => "00dfba8194c41b84cf",
                "display" => true,
                "hidden" => false
            ],
            [
                "type" => "upload",
                "field" => "sign_cert",
                "title" => "加签证书",
                "props" => array_merge($uploadProps, [
                    "accept" => ".cer,.crt,.pem"
                ]),
                "_fc_drag_tag" => "upload",
                "_fc_id" => "id_F9q8mh2zkilk14dc",
                "name" => "ref_Faihmh2zkilk14ec",
                "display" => true,
                "hidden" => false
            ],
            [
                "type" => "upload",
                "field" => "verify_cert",
                "title" => "异步通知验签证书",
                "props" => array_merge($uploadProps, [
                    "accept" => ".cer,.crt,.pem"
                ]),
                "_fc_drag_tag" => "upload",
                "_fc_id" => "id_F8rlmh2zkilk14pc",
                "name" => "ref_Fognmh2zkilk14qc",
                "display" => true,
                "hidden" => false
            ],
            [
                "type" => "upload",
                "field" => "receiver_agreement_file",
                "title" => "分账接收方默认合作协议文件",
                "props" => array_merge($uploadProps, [
                    "accept" => ".pdf,.png,.jpg,.jpeg,.doc,.docx"
                ]),
                "_fc_drag_tag" => "upload",
                "_fc_id" => "id_F8rlmh2zkilk14pc",
                "name" => "ref_Fognmh2zkilk14qc",
                "display" => true,
                "hidden" => false
            ],
            [
                "type" => "input",
                "title" => "机构代码（org_code）",
                "field" => "org_code",
                "value" => "1",
                "props" => [
                    "placeholder" => "请输入机构代码"
                ],
                "\$required" => true,
                "_fc_id" => "id_F0j5md1fz7stawc",
                "name" => "ref_Ffipmd1fz7staxc",
                "_fc_drag_tag" => "input",
                "display" => true,
                "hidden" => false
            ],
            [
                "type" => "input",
                "title" => "子商户公众账号ID（sub_appid）",
                "field" => "sub_appid",
                "value" => "wx1308d811d01639eb",
                "props" => [
                    "placeholder" => "请输入子商户公众账号ID"
                ],
                "\$required" => true,
                "_fc_id" => "id_F0j5md1fz7stawc",
                "name" => "ref_Ffipmd1fz7staxc",
                "_fc_drag_tag" => "input",
                "display" => true,
                "hidden" => false
            ],
            [
                "type" => "input",
                "title" => "支付回调地址",
                "field" => "notify_url",
                "value" => "https://sixshop.ddev.site/api/lakala/notify",
                "props" => [
                    "placeholder" => "请输入支付结果通知回调地址"
                ],
                "\$required" => true,
                "_fc_id" => "id_F0j5md1fz7stawc",
                "name" => "ref_Ffipmd1fz7staxc",
                "_fc_drag_tag" => "input",
                "display" => true,
                "hidden" => false
            ],
            [
                "type" => "input",
                "title" => "收货确认通知地址",
                "field" => "complete_notify_url",
                "value" => "https://sixshop.ddev.site/api/lakala/notify",
                "props" => [
                    "placeholder" => "请输入收货确认通知地址"
                ],
                "\$required" => true,
                "_fc_id" => "id_F0j5md1fz7stawc",
                "name" => "ref_Ffipmd1fz7staxc",
                "_fc_drag_tag" => "input",
                "display" => true,
                "hidden" => false
            ]
        ],
        "_fc_drag_tag" => "elCard",
        "_fc_id" => "id_Fpcxmh2zkilk14fc",
        "name" => "ref_F8tcmh2zkilk14gc",
        "display" => true,
        "hidden" => false
    ],
    [
        "type" => "elCard",
        "props" => [
            "header" => "说明信息"
        ],
        "style" => [
            "width" => "100%",
            "marginBottom" => "20px"
        ],
        "children" => [
            [
                "type" => "text",
                "style" => [
                    "whiteSpace" => "pre-line",
                    "color" => "#666",
                    "fontSize" => "14px"
                ],
                "children" => [
                    "配置说明：\n• 接入方唯一编号（appid）：拉卡拉分配的接入方标识\n• 证书序列号（serial_no）：接入方生成的cer证书序列号\n• 加签证书：接入方生成的证书文件，用于请求签名\n• 商户号（merchant_no）：商户进件时产生的唯一标识\n• 终端号（term_no）：商户进件时分配的终端标识\n• 异步通知验签证书：拉卡拉分配的证书，用于验证异步通知签名\n• 环境选择：选择测试环境或生产环境，系统将使用对应的API地址"
                ],
                "_fc_drag_tag" => "text",
                "_fc_id" => "id_Fsaamh2zkilk14vc",
                "name" => "ref_Fjplmh2zkilk14wc",
                "display" => true,
                "hidden" => false
            ]
        ],
        "_fc_drag_tag" => "elCard",
        "_fc_id" => "id_Fg6amh2zkilk151c",
        "name" => "ref_Fqcvmh2zkilk152c",
        "display" => true,
        "hidden" => false
    ],
    [
        "type" => "input",
        "title" => "随机立减金额上限",
        "field" => "random_discount_max",
        "value" => "0",
        "props" => [
            "placeholder" => "请输入随机立减金额上限，如：0.5（表示0到0.5之间的随机减免）",
            "type" => "number",
            "min" => 0.01,
            "step" => 0.01
        ],
        "_fc_id" => "id_FrandomDiscount",
        "name" => "ref_FrandomDiscount",
        "_fc_drag_tag" => "input",
        "display" => true,
        "hidden" => false
    ],
    [
        'type' => 'group',
        'field' => 'sub_merchant_list',
        'title' => '子商户(默认使用第一个子商户)',
        '\$required' => false,
        'props' => [
            'title' => '第{index}页',
            'rule' => $subMerchant,
        ],
        '_fc_id' => 'id_Fwmtmie6qfnpb5c',
        'name' => 'ref_Frozmie6qfnpb6c',
        '_fc_drag_tag' => 'group',
        'display' => true,
        'hidden' => false
    ],
    [
        'type' => 'number',
        'field' => 'profit_share_fee',
        'value' => 6,
        'title' => '分账手续费',
        'info' => '分账手续费百分比',
        '$required' => false,
        'props' => [
            'precision' => 2,
            'min' => 1,
            'max' => 50,
            'step' => 0.01,
            'stepStrictly' => true
        ],
        '_fc_id' => 'id_Feeemdycfeeubbc',
        'name' => 'ref_Feeemdycfeeubbd',
        'display' => true,
        'hidden' => false,
        '_fc_drag_tag' => 'inputNumber',
        'wrap' => [
            'labelWidth' => '200px'
        ]
    ],
    [
        'type' => 'number',
        'field' => 'profit_share_min',
        'value' => 100,
        'title' => '分账最低金额',
        'info' => '',
        '$required' => false,
        '_fc_id' => 'id_Fminmdycminubcc',
        'name' => 'ref_Fminmdycminubcd',
        'display' => true,
        'hidden' => false,
        '_fc_drag_tag' => 'inputNumber',
        'wrap' => [
            'labelWidth' => '200px'
        ]
    ],
    [
        'type' => 'number',
        'field' => 'profit_share_max',
        'value' => 5000,
        'title' => '分账最高金额',
        'info' => '',
        '$required' => false,
        '_fc_id' => 'id_Fmaxmdycmaxubdc',
        'name' => 'ref_Fmaxmdycmaxubdd',
        'display' => true,
        'hidden' => false,
        '_fc_drag_tag' => 'inputNumber',
        'wrap' => [
            'labelWidth' => '200px'
        ]
    ],
];